package com.seari.service;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.seari.bean.SnapshotBean;
import com.seari.mapper.SnapshotMapper;

@Service
public class SnapshotServiceImpl implements SnapshotService
{
	private JSONObject jsonCacheMap = new JSONObject();
	@Autowired
	private AppCacheService appCacheService;
	@Autowired
	private SnapshotMapper snapshotMapper;
	
	@Override
	public void dumpAppCacheToJson()
	{
		@SuppressWarnings("unchecked")
		List<Object> data = (List<Object>) appCacheService.getCacheObject("allGroupFullLoad");
		JSONArray jsonArray = new JSONArray(data);
		jsonCacheMap.put("allGroupFullLoad", jsonArray);
	}


	@Override
	public List<SnapshotBean> getSnapshotByTime()
	{
		// TODO Auto-generated method stub
		return snapshotMapper.getSnapshotByTime();
	}


	@Override
	public void insertObject(byte[] obj)
	{
		// TODO Auto-generated method stub
		snapshotMapper.insertObject(obj);
	}

	

}
